<!--!
This file is a part of MediaDrop (https://www.mediadrop.video),
Copyright 2009-2018 MediaDrop contributors
For the exact contribution history, see the git revision log.
The source code contained in this file is licensed under the GPLv3 or
(at your option) any later version.
See LICENSE.txt in the main project directory, for more information.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:i18n="http://genshi.edgewall.org/i18n"
      xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="/admin/settings/master.html" />
<head>
	<title>Tags</title>
	<script src="${h.url_for('/scripts/third-party/squeezebox-1.1-rc4-yui-compressed.js')}" type="text/javascript"></script>
	<link href="${h.url_for('/admin/styles/squeezebox.css')}" media="screen" rel="stylesheet" type="text/css" />
	<link href="${h.url_for('/admin/styles/forms.css')}" media="screen" rel="stylesheet" type="text/css" />
	<link href="${h.url_for('/admin/styles/categories.css')}" media="screen" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="${h.url_for('/admin/scripts/forms.js')}"></script>
	<script type="text/javascript" src="${h.url_for('/admin/scripts/modals.js')}"></script>
	<script type="text/javascript" src="${h.url_for('/admin/scripts/confirm.js')}"></script>
	<script type="text/javascript" src="${h.url_for('/admin/scripts/tablemgrs.js')}"></script>
	<script type="text/javascript">
		window.addEvent('domready', function(){
			var tagtbl = new TagTable('tag-table', {
				addButton: 'add-tag-btn',
				prefix: 'tag-'
			});
			var bulkDelete = new BulkDelete(tagtbl, {
				saveUrl: '${h.url_for(action='bulk', type='delete')}',
				confirmMgr: {
					header: '${_('Confirm Delete').replace("'", "\\'")}',
					msg: function(num){ return '${_('Are you sure you want to delete these %(num)s items?').replace("'", "\\'") % dict(num="'+num+'")}'; },
					confirmButtonText: '${_('Delete').replace("'", "\\'")}',
					cancelButtonText: '${_('Cancel').replace("'", "\\'")}',
				}
			});
			$$('bulk-delete').addEvent('click', bulkDelete.onClick.bind(bulkDelete));
		});
	</script>
</head>
<body class="menu-cattags-on">
	<div class="box">
		<div class="box-head">
			<h1>Tags</h1>
			<div class="f-rgt">
				<a id="add-tag-btn" href="${h.url_for(action='edit', id='new')}" class="btn inline btn-add-tag f-lft"><span>Add Tag</span></a>
				<button id="bulk-delete" class="btn inline btn-add-tag f-lft" style="margin-left:10px"><span>Bulk Delete</span></button>
			</div>
			<!--!<span class="box-head-sec">${h.doc_link('admin/settings', 'tags')}</span>-->
		</div>
		<table cellpadding="0" cellspacing="0" id="tag-table">
			<thead>
				<tr>
					<th id="h-bulk" style="width:20px"><input type="checkbox" class="bulk-toggle" /></th>
					<th id="h-name">Name</th>
					<th id="h-media_count" style="width:58px" class="center">Media</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<tr py:for="tag in tags" id="tag-${tag.id}" py:replace="tag_row_form(tag=tag)" />
			</tbody>
			${paginated_tfoot(c.paginators.tags, 4)}
		</table>
	</div>

	<div id="add-box" class="box hidden">
		<h1 class="box-head">Add Tag</h1>
		${tag_form(action=h.url_for(action='save', id='new'))}
	</div>
	<div id="edit-box" class="box hidden">
		<h1 class="box-head">Edit Tag</h1>
		${tag_form()}
	</div>
	<div id="delete-box" class="box hidden">
		<h1 class="box-head">Delete Tag</h1>
		<form>
			<input py:for="field in ('name', 'slug')" type="hidden" name="${field}" value="" />
			<p class="box-content">Are you sure you want to delete this?</p>
			<div class="box-foot">
				<button type="reset" name="cancel" class="btn f-lft"><span>Cancel</span></button>
				<button type="submit" name="delete" class="btn red f-rgt"><span>Delete</span></button>
			</div>
		</form>
	</div>
</body>
</html>
